<?php
/**
 * Created by PhpStorm.
 * User: 胥九庆
 * Date: 2023/01/04
 * Time: 16:30
 */
declare (strict_types=1);

namespace app\api\controller;

use app\common\tool\Result;
use think\Response;
use app\common\model\CollegeCate as CollegeCateModel;

class CollegeCate extends Base
{
    public function index(): Response
    {
        $param = $this->request->get();
        $where['status'] = 1;
        $where['is_del'] = 0;
        $that = CollegeCateModel::where($where);
        if (isset($param['type']) && $param['type']) {
            if ($param['type'] == 1) {
                $that->where('id', '<=', 3);
            }
            if ($param['type'] == 2) {
                $that->where('id', '>', 3);
            }
        }
        $list = $that->field('id,title,icon')->order('sort asc, id asc')->select();

        return Result::success('success', $list);
    }
}


